<?php
/**
  * @author zhenc
  * @time
  * @param  获取配置值config.xml https://www.mageplaza.com/magento-2-module-development/create-system-xml-configuration-magento-2.html
  * @return
*/

namespace Mageplaza\HelloWorld\Controller\Index;

class Config extends \Magento\Framework\App\Action\Action
{

    protected $helperData;

    public function __construct(
        \Magento\Framework\App\Action\Context $context,
        \Mageplaza\HelloWorld\Helper\Data $helperData

    )
    {
        $this->helperData = $helperData;
        return parent::__construct($context);
    }

    public function execute()
    {

        // TODO: Implement execute() method.

        echo $this->helperData->getGeneralConfig('enable');
        echo $this->helperData->getGeneralConfig('display_text');
        exit();

    }
    protected function _isAllowed()
    {

        return $this->_authorization->isAllowed('Mageplaza_HelloWorld::Index');
    }
}